<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html lang="en">
<script type="text/javascript" src="/cooknote/resources/jquery.js"></script>


<script type="text/javascript">
$(document).ready(function() {
		 $.ajax({
// 		        datatype:"json",
		        type: "POST",
		        url: "/cooknote/user_detail.json",
// 		        url: "/cooknote/user_detail.xml",
// 		        url: "/cooknote/user_detail.json",
		        data: $("#frmtest").serialize(),
		        success: function(response)
		        {
		            console.log(response);
		            set_detail(response);
		        },
		        error: function(e)
		        {
		            console.log('Error: ' + e);
		        }
		    });
});


function set_detail(json){
	$("#user_id").text( json.user_id );
}

function go_list(){
	$('#frmtest').attr('method','GET')
	$('#frmtest').attr('action','/cooknote/user_list_form').submit();
}

function go_update(){
	$('#frmtest').attr('method','GET')
	$('#frmtest').attr('action','/cooknote/user_update_form').submit();
}

//관리자 - 공지사항 삭제 process
function delete_process(){

	 $.ajax({
// 	        datatype:"json",
	        type: "POST",
	        url: "/cooknote/user_delete.json",
	        data: $("#frmtest").serialize(),
	        success: function(response)
	        {
	        	//before,after 생각해 보자

	            console.log(response);
	        },
	        error: function(e)
	        {
	            console.log('Error: ' + e);
	        }
	    });
}
</script>

<body>
<div class="container">

${user.user_id}
<br/>
<br/>
${userDetail.user_id}<br/>
${userDetail.nick_name}<br/>
<br/>
<br/>
${userm.nick_name}<br/>
${userm.user_id}



	<form id="frmtest" name="frmtest">
			<input type="text" name="user_id" value="${user.user_id}"/>
	</form>
	<table id="target_table" class="target_table_css" summary="공지사항 상세보기">
		<tbody>
			<tr>
				<th>제목</th>
				<td><span id="user_id"></span></td>
			</tr>
			<tr>
				<th>닉네임</th>
				<td><span id="nick_name"></span></td>
			</tr>
		</tbody>
	</table>

	<table>
			<tbody>
				<tr>
					<td>
					<a href="#" onclick="javascript:go_update();">수정</a>
					</td>
					<td><a href="#" onclick="javascript:delete_process();">삭제</a></td>
					<td>
						<a href="#" onclick="javascript:go_list();">리스트</a>
					</td>
				</tr>
			</tbody>
	</table>
</div>

</body>

</html>
